﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Autofac;
using Hyt.Core;
using Hyt.Web.Security;

namespace Hyt.Web
{
    public abstract class IocSetting : IIocSetting
    {
        public void Register(ContainerBuilder builder, IUnitOfWork unitOfWork)
        {
            RegisterISafeCodeProvider(builder);
        }


        /// <summary>
        /// 注册安全码提供器
        /// </summary>
        /// <param name="builder"></param>
        public virtual void RegisterISafeCodeProvider(ContainerBuilder builder)
        {
            builder.RegisterType(GetSafeCodeProvider()).As<ISafeCodeProvider>().PropertiesAutowired();
        }

        /// <summary>
        /// 安全码提供器
        /// </summary>
        /// <returns></returns>
        public abstract Type GetSafeCodeProvider();

    }
}
